<script>
	export default {
		onLaunch: function() {
			console.log('App Launch');
			let isCanUse = uni.getStorageSync('isCanUse');
			
			//不存在isCanUse 对象确定为首次授权
			if (isCanUse == undefined || isCanUse.length == 0 ) {
				console.log("-----App setIsCanUse-----");
				uni.setStorageSync('isCanUse', true);
			} else {
				this.$store.commit('setIsCanUse');
				uni.setStorageSync('isCanUse', false);
			}

			uni.removeStorage({
				key: 'storage_key',
				success: function(res) {
					console.log('清除存储中的登陆信息成功');
				}
			});

			setTimeout(() => {
				uni.setTabBarBadge({
					index: 1,
					text: '31'
				});
				uni.showTabBarRedDot({
					index: 3
				});
			}, 1000);

			// 临时注入openid信息
			// this.$store.commit('setOpenid', 'o-B3q1fzZ_eK-wejsR0S_nIqCO-o');

			// #ifdef H5		
			this.$store.commit('loginH5');
			// #endif

			// #ifdef MP-WEIXIN
			this.$store.commit('login');
			// #endif
		},
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		},
		methods: {}
	};
</script>

<style>
	/*每个页面公共css */
</style>
